﻿@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using NewLife.Common;
@{
    Layout = NewLife.Cube.Setting.Current.Layout;

    ViewBag.Title = "进程模块";
    var Act = ViewBag.Act;

    var asm = Assembly.GetExecutingAssembly();
    var att = asm.GetCustomAttribute<TargetFrameworkAttribute>();
    var ver = att.FrameworkDisplayName ?? att.FrameworkName;

    var isAll = String.Equals("All", Request["Mode"], StringComparison.OrdinalIgnoreCase);

    var process = Process.GetCurrentProcess();
    var list = new List<ProcessModule>();
    foreach (ProcessModule item in process.Modules)
    {
        if (isAll || item.FileVersionInfo.CompanyName != "Microsoft Corporation") { list.Add(item); }
    }
}          

<div class="kt-portlet kt-portlet--last kt-portlet--mobile">
    <div class="kt-portlet__head">
        <div class="kt-portlet__head-label">
                <span class="kt-portlet__head-icon">
                    <i class="la la-gear"></i>
                </span>
                <h3 class="kt-portlet__head-title">
                    进程模块(@process.ProcessName , PID=@process.Id )
                    @if (!isAll)
                    {
                        <text>（<a href="?Mode=All">完整</a>，仅用户）：</text>
                    }
                    else
                    {
                        <text>（完整，<a href="?Mode=OnlyUser">仅用户</a>）：</text>
                    }
                </h3>
        </div>
    </div>
    <div class="kt-portlet__body">
        <table class="table table-bordered table-hover table-striped table-condensed">
            <tr>
                <th>模块名称</th>
                <th>公司名称</th>
                <th>产品名称</th>
                <th>描述</th>
                <th>版本</th>
                <th>大小</th>
                <th>路径</th>
            </tr>
            @foreach (ProcessModule item in list)
            {
                <tr>
                    <td>@item.ModuleName</td>
                    <td>@item.FileVersionInfo.CompanyName</td>
                    <td>@item.FileVersionInfo.ProductName</td>
                    <td>@item.FileVersionInfo.FileDescription</td>
                    <td>@item.FileVersionInfo.FileVersion</td>
                    <td>@item.ModuleMemorySize</td>
                    <td>@item.FileName</td>
                </tr>
            }
        </table>
    </div>
</div>
